function Add_usdt(){
    var ii = layer.load(5, {
		shade: [0.1, '#fff']
	});
	var usdt_address = $("#usdt_address").val();
    var beizhu =$("#beizhu").val();
    $.ajax({
        type: "POST",
        url: "Ajax.php",
        data: {
            act: 'Add_usdt',
            usdt_address: usdt_address,
            beizhu: beizhu
        },
        dataType: 'json',
		timeout: 15000,
		success: function(data) {
		    layer.close(ii)
		    if(data.code == 200){
		        layer.msg(data.msg, {
                    icon: 1,
                    time: 1000
                }, function() {
                    location.reload();
                });
		    }else{
		        layer.msg(data.msg, {
                    icon: 2,
                    time: 3000
                });
		    }
		},
		error: function(data) {
            layer.close(ii);
            layer.msg('服务器错误');
        }
    });
}

function editSave(id){
    layer.open({
		type: 2,
		maxmin: true,
		title: '修改二维码',
		shade: 0.1,
		area: screen(),
		content: "usdt?my=edit&id="+id
	});
}
function screen() {
	if (typeof width !== 'number' || width === 0) {
		width = $(window).width() * 0.8;
	}
	if (typeof height !== 'number' || height === 0) {
		height = $(window).height() * 0.5;
	}
	return [width + 'px', height + 'px'];
}
function edit_Qr(){
	var id= $("#id").val(); 
	var beizhu = $("#beizhu").val();
	var status = $("#status").val();
	var usdt_address = $("#usdt_address").val();
	var ii = layer.load(3, {
		shade: [0.1, '#fff']
	});
	$.ajax({
	    type: "POST",
	    url: "Ajax.php",
	    data: {
	        act:'edit_usdt',
	        id:id,
	        beizhu:beizhu,
	        status:status,
	        usdt_address:usdt_address
	    },
	    dataType: 'json',
	    timeout: 15000,
	    success: function(data) {
	        layer.close(ii);
	         if (data.code == 200){
	             layer.msg(data.msg, {
                    icon: 1,
                    time: 2000
                }, function() {
                    // 关闭编辑窗口
                   window.parent.closeEditWindow();
                    location.reload();
                });
	         }else{
	             layer.msg(data.msg, {
                    icon: 2,
                    time: 3000
                });
	         }
	    },
        error: function(data) {
            layer.close(ii);
            layer.msg('操作失败,服务器错误');
        }
	});
}

function closeEditWindow() {
    layer.closeAll('iframe');
}